const Mock = require('mockjs')

const List = []
const count = 300

for (let i = 0; i < count; i++) {
  List.push(Mock.mock({
    id: '@id',
    num: Mock.Random.string('number', 8),
    name: Mock.mock('@name'),
    school: '人工智能与大数据学院',
    class: '2020计应1班',
    gradute_time: '@datetime',
    'status|1': ['在校', '退学', '休学', '参军']
  }))
}

module.exports = [
  {
    url: '/vue-admin-template/student/list',
    type: 'get',
    response: config => {
      const { page = 1, limit = 20 } = config.query
      const mockList = List.filter((item) => {
        if (item && item.name.indexOf(name) < 0) return false
        if (status && item.status !== status) return false
      })
      const pageList = List.filter((item, index) =>
        index < limit * page && index >= limit * (page - 1))
      return {
        code: 20000,
        data: {
          total: List.length,
          items: pageList
        }
      }
    }
  }
]
// {
//   url: '/vue-admin-template/student/update',
//   type: 'post',
//   response: _=> {

//   }
// }
